texture particleTexture;
sampler Sampler = sampler_state
{
	Texture = <particleTexture>;
	MinFilter = Linear;
    MagFilter = Linear;
    MipFilter = Linear;
};

half4x4 WorldViewProj : WorldViewProjection;
half4x4 Projection : Projection;

half ViewportHeight;

struct VS_OUTPUT
{
	half4 Position : POSITION0;
	half2 TexCoord : TEXCOORD0;
    half4 Color : COLOR0;
	half psize : PSIZE0;
};

struct VS_INPUT
{
	half4 pos : POSITION0;
	half4 color : COLOR0;
	half2 data : TEXCOORD0;
};

VS_OUTPUT VertexShader(VS_INPUT input)
{
	VS_OUTPUT Output = (VS_OUTPUT)0;
	
	Output.Position = mul(input.pos, WorldViewProj);	
	
	Output.Color = input.color;	
	
	Output.Color.a = input.data.y;				
	
	Output.psize = input.data.x * Projection._m11 / Output.Position.w * ViewportHeight / 2;
	
	return Output;
}
half4 PixelShader(VS_OUTPUT input) : COLOR0
{
	half4 Color = tex2D(Sampler, input.TexCoord.xy);
	
	Color *= input.Color;	
	
	return Color;	
}
technique PointSpriteTechnique
{
    pass P0
    {   
        vertexShader = compile vs_2_0 VertexShader();
        pixelShader = compile ps_2_0 PixelShader();        
    }
}